/*
 * Copyright (c) 2023 Huawei Technologies Co.,Ltd.
 *
 * openInula is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *
 *          http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

@import 'assets.less';

.infoContainer {
  display: flex;
  flex-direction: column;
  height: 100%;

  .button {
    border: none;
    padding: 0;
    border-radius: 0.25rem;
    flex: 0 0 auto;
    cursor: pointer;
    color: #5f6673;
  }

  .button :hover {
    color: #23272f;
  }

  .componentInfoHead {
    flex: 0 0 @top-height;
    display: flex;
    align-items: center;
    border-bottom: @divider-style;

    .name {
      flex: 1 1 auto;
      padding: 0 1rem 0 1rem;
      .text {
        display: block;
      }
    }

    .eye {
      flex: 0 0 1rem;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      padding: 0.25rem 0.5rem 0.25rem 0.25rem;
    }

    .debug {
      flex: 0 0 1rem;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      padding: 0.25rem 0.5rem 0.25rem 0;
    }

    .location {
      flex: 0 0 1rem;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      padding: 0.25rem 0.5rem 0.25rem 0;
    }
  }

  .componentInfoMain {
    overflow-y: auto;

    > :last-child {
      border-bottom: unset;
    }

    > div {
      border-bottom: @divider-style;
    }

    .attrContainer {
      flex: 0 0;

      .attrHead {
        display: flex;
        flex-direction: row;
        align-items: center;
        padding: 0.5rem 0.5rem 0 0.5rem;

        .attrType {
          flex: 1 1 0;
        }

        .attrCopy {
          flex: 0 0 1rem;
          padding-right: 1rem;
        }
      }

      .attrDetail {
        padding-bottom: 0.5rem;

        .attrArrow {
          color: @arrow-color;
          width: 12px;
          display: inline-block;
        }

        .attrName {
          margin-top: 1px;
          color: @attr-name-color;
          font-family: @attr-name-font-family;
        }

        .colon {
          margin-top: 1px;
          transform: translateY(-8%);
          margin-right: 0.5rem;
        }

        .info {
          display: flex;
          &:hover {
            .operation {
              visibility: visible;
              .operationIcon :hover {
                border: none;
                border-radius: 5px;
                background-color: lightskyblue;
              }
            }
          }
        }

        .attrValue {
          width: 26rem;
          height: 1rem;
          text-overflow: ellipsis;
          white-space: nowrap;
          overflow: hidden;
          font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo,
          Courier, monospace;
          &:focus {
            color: unset;
            background-color: #f0f0f0;
          }
        }
        .attrValue[data-type='string'] {
          color: #009906;
        }
        .attrValue[data-type='function'] {
          color: royalblue;
        }
        .attrValue[data-type='number'] {
          color: #ff5722;
        }
        .attrValue[data-type='boolean'] {
          color: #03a9f4;
        }

        .operation {
          cursor: pointer;
          visibility: hidden;
        }

        .checkBox {
          margin: 2px 3px 0 auto;
          justify-content: flex-end;
        }
      }
    }

    .dropdown.active {
      display: unset;
      top: var(--content-top);
      left: var(--content-left);
      position: absolute;
      ul {
        margin-block-start: 0;
        padding-inline-start: 0;
        li {
          padding: 10px;
          border-top: 1px lighten(#333, 2%) solid;
          height: auto;
          overflow: auto;
          opacity: 1;
        }
      }
    }

    .dropdown {
      display: none;

      ul {
        display: block;
        position: relative;
        list-style: none;
      }

      li {
        padding: 0 10px;
        background: darken(#333, 2%);
        color: darken(#EEE, 40%);
        text-align: left;
        border: 0;
        width: 100%;
        height: 0;
        overflow: hidden;
        cursor: pointer;
        opacity: 0;
        transition-property: all, background-color;
        transition-duration: 0.2s, 0.4s;

        &:hover, &.selected {
          background-color: darken(#333, 10%);
        }

        &:active {
          background: #03a9f4;
        }

        &:first-child {
          border-radius: 5px 5px 0 0;
        }

        &:last-child {
          border-radius: 0 0 5px 5px;
        }

        &:before {
          margin-top: -2px;
          margin-right: 10px;
          display: inline-block;
          border-radius: 5px;
          vertical-align: middle;
          width: 16px;
          height: 16px;
        }

        &:nth-child(1) {
          &:before {
            content: url('../svgs/copy.svg');
          }
        }

        &:nth-child(2) {
          &:before {
            content: url('../svgs/storage.svg');
          }
        }
      }
    }
  }

  .parentsInfo {
    flex: 1 1 0;

    .parentName {
      padding: 0.5rem 0.5rem 0 0.5rem;
    }

    .parent {
      margin-left: 1.4rem;
      display: block;
      cursor: pointer;
      text-align: left;
      color: @component-name-color;

      &:hover {
        background-color: @select-color;
      }
    }
  }
}
